//
//  ProfileHeadView.m
//  ChatForHot
//
//  Created by FLY on 2018/10/11.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "ProfileHeadView.h"

@implementation ProfileHeadView

- (instancetype)init{
    
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self HOTCHATlayoutViews];
    }
    return self;
}

- (void)HOTCHATlayoutViews{
    
    [self addSubview:self.HOTCHATheadImgView];
    [self addSubview:self.HOTCHATnameView];
    [self addSubview:self.HOTCHATnameLab];
    [self addSubview:self.HOTCHATtextField];
    
    [self.HOTCHATheadImgView mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.width.height.mas_equalTo(90);
        make.centerX.equalTo(self);
        make.top.equalTo(self).mas_offset(40);
    }];
    [self.HOTCHATnameView mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).mas_offset(30);
        make.right.equalTo(self.mas_right).mas_offset(-30);
        make.top.equalTo(self.HOTCHATheadImgView.mas_bottom).mas_offset(30);
        make.height.mas_equalTo(50);
    }];
    [self.HOTCHATnameLab mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.HOTCHATnameView.mas_left).mas_offset(15);
        make.centerY.equalTo(self.HOTCHATnameView.mas_centerY);
    }];
    
    [self.HOTCHATtextField mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.HOTCHATnameLab.mas_right).mas_offset(15);
        make.width.mas_equalTo(180);
        make.centerY.equalTo(self.HOTCHATnameLab.mas_centerY);
    }];
    
}
//lazzy
- (UIImageView *)HOTCHATheadImgView{
    
    if (_HOTCHATheadImgView == nil) {
        
        _HOTCHATheadImgView = [[UIImageView alloc]init];
        _HOTCHATheadImgView.layer.masksToBounds = YES;
        _HOTCHATheadImgView.layer.cornerRadius = 90/2;
        _HOTCHATheadImgView.image = [UIImage imageNamed:@"personal_atatar_but_h"];
    }
    return _HOTCHATheadImgView;
}
- (UIView *)HOTCHATnameView{
    
    if (_HOTCHATnameView == nil) {
        
        _HOTCHATnameView = [[UIView alloc]init];
        _HOTCHATnameView.backgroundColor = [UIColor whiteColor];
        _HOTCHATnameView.layer.masksToBounds = YES;
        _HOTCHATnameView.layer.cornerRadius = 4;
    }
    return _HOTCHATnameView;
}
- (UILabel *)HOTCHATnameLab{
    
    if (_HOTCHATnameLab == nil) {
        
        _HOTCHATnameLab = [[UILabel alloc]init];
        _HOTCHATnameLab.font = [UIFont systemFontOfSize:15];
        _HOTCHATnameLab.textColor =HOTCHATHexColor(0xABA5B3);
        _HOTCHATnameLab.text = NSLocalizedString(@"StrN015", nil);
    }
    return _HOTCHATnameLab;
}
- (UITextField *)HOTCHATtextField{
    
    if (_HOTCHATtextField == nil) {
        
        _HOTCHATtextField = [[UITextField alloc] init];
        _HOTCHATtextField.placeholder = NSLocalizedString(@"StrN021", nil);
        _HOTCHATtextField.clearButtonMode = UITextFieldViewModeWhileEditing;
        _HOTCHATtextField.textColor = HOTCHATHexColor(0x111111);
        _HOTCHATtextField.font = [UIFont systemFontOfSize:15];
        _HOTCHATtextField.textAlignment = NSTextAlignmentCenter;
        [_HOTCHATtextField setValue:HOTCHATHexColor(0xABA5B3) forKeyPath:@"_placeholderLabel.textColor"];
    }
    return _HOTCHATtextField;
}
@end
